//
//  WFPIcsCell.m
//  谷居
//
//  Created by dllo on 16/6/21.
//  Copyright © 2016年 刘万方. All rights reserved.
//

#import "WFPIcsCell.h"
#import "WFHandleURL.h"
@implementation WFPIcsCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createCell];
    }
    return self;
}


- (void)createCell {
    _photoImageView = [[WFImageView alloc] initWithFrame:self.contentView.frame];
    [self.contentView addSubview:_photoImageView];
    [_photoImageView release];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    /** 为了避免重用之后造成子视图的尺寸有问题, 所以在layoutSubViews方法重新设置子视图的尺寸. */
    self.photoImageView.frame = self.contentView.frame;
    NSString *url = [WFHandleURL getPicURL:_photoModel.id];
//    NSLog(@"%ld", _photoModel.id);
//    NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];
    [_photoImageView setImageWithURL:[NSURL URLWithString:url]];
//    [_photoImageView setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:@"placeholder-avatar"]];
//    _photoImageView.image = [UIImage imageWithData:data];
}

@end
